﻿--|--------------------------------------------------------------------------------
--| [DeletePerson] - Update Procedure Script for Entity
--|--------------------------------------------------------------------------------
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id (N'[dbo].[DeletePerson]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1) 
	DROP PROCEDURE [dbo].[DeletePerson]
GO

CREATE PROCEDURE [dbo].[DeletePerson]
(
	@ID int
)
AS
	SET NOCOUNT ON
	BEGIN TRAN

	DELETE FROM dbo.[EntityAttribute]
	WHERE  EntityID = @ID 
	DELETE 
	FROM   [Entity]
	WHERE  
		[ID] = @ID
	COMMIT TRAN
	RETURN @@Error 
	
GO 